#pragma once

#include "ChunkItem.h"
#include "Terrain.h"

namespace ChunkSystem
{
	class Chunk;

	class TerrainBlockChunkItem
		:public ChunkItem
	{
	public:
		TerrainBlockChunkItem( const String& strResId, Chunk* pParent );
		virtual ~TerrainBlockChunkItem(void);
		
		//Chunk Item Interface
		virtual bool Load( TiXmlElement* pChunkData );
		virtual void Unload( void );
		virtual void UpdateAABB( void );

		//virtual void CreateVisible(IRenderableFactory* pFac);
		//virtual void DestoryVisible(void);
		//virtual void DrawVisible( IRenderer* pRenderer );

		//update physics
		virtual bool InitSync( void );

		TerrainSystem::Terrain*	GetTerrainInstance(void) const;

	private:
		Chunk*	m_pOwnerChunk;
		TerrainSystem::Terrain*	m_pTerrainInstance;
	};

	class TerrainBlockChunkFactory
		:public ChunkItemFactory
	{
	public:
		TerrainBlockChunkFactory( void ){}
		virtual ~TerrainBlockChunkFactory( void ){}

		virtual String GetType(void);
		virtual ChunkItem* Create( ChunkItem* pOwner, TiXmlElement* pChunkItemData );
	};

}